<?php
// 考生答卷表 migration
use think\migration\Migrator;
use Phinx\Db\Adapter\MysqlAdapter;

class ExamUserPaper extends Migrator
{
    public function change()
    {
        $table = $this->table('exam_user_paper');
        $table->addColumn('user_id', 'integer', ['default' => 0, 'comment' => '考生ID'])
            ->addColumn('paper_id', 'integer', ['default' => 0, 'comment' => '试卷ID'])
            ->addColumn('score', 'integer', ['default' => 0, 'comment' => '总得分'])
            ->addColumn('status', 'string', ['limit' => 16, 'default' => 'pending', 'comment' => '状态: pending, finished, reviewed'])
            ->addColumn('start_time', 'integer', ['default' => 0, 'comment' => '开始时间'])
            ->addColumn('end_time', 'integer', ['default' => 0, 'comment' => '结束时间'])
            ->addColumn('create_time', 'integer', ['default' => 0])
            ->addColumn('update_time', 'integer', ['default' => 0])
            ->create();
    }
}
